package com.woniu.controller;

import com.github.pagehelper.PageInfo;
import com.woniu.dto.PageData;
import com.woniu.entity.Customer;
import com.woniu.entity.InsuranceTeam;
import com.woniu.service.InsuranceTeamService;
import com.woniu.utils.ResData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class JointGroupController {


    @Autowired
    private InsuranceTeamService insuranceTeamService;

    /**
     * 查询联保小组成员列表
     * @param pageData
     * @return
     */
    @RequestMapping("/queryGroupList")
    public ResData queryGroupList(@RequestBody PageData<InsuranceTeam> pageData) {
        PageInfo<InsuranceTeam> insuranceTeamPageInfo = insuranceTeamService.queryGroupList(pageData);
        return ResData.success(insuranceTeamPageInfo);
    }


    /**
     * 添加联保小组基本信息
     */
    @RequestMapping("addGroup")
    public ResData addGroup(@RequestBody InsuranceTeam insuranceTeam) {
        int addGroup =insuranceTeamService.addGroup(insuranceTeam);
        return ResData.success(addGroup);
    }
    /**
     * 删除小组
     */
    @RequestMapping("deleteGroup/{id}")
    public ResData deleteGroup(@PathVariable String id) {
        return ResData.success(insuranceTeamService.deleteGroup(id));
    }
}
